cmake_minimum_required(VERSION 3.16)

project(PrintHello)

add_compile_options(-std=c11)
#设置库文件的输出目录，默认输出到执行目录空间下
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

include_directories(include)
#add_executable(PrintHello src/hello.c main.c)
#静态库名为xxx.a  Win下动态库为xxx.dll   Unix下动态库为xxx.so
add_library(PrintHello SHARED src/hello.c)

#不可直接使用add_library再次添加静态库,命名冲突
#add_library(PrintHello STATIC src/hello.c)
add_library(PrintHello_Static STATIC src/hello.c) #重建工程名解决


set_target_properties(PrintHello_Static PROPERTIES OUTPUT_NAME "PrintHello")